#include<bits/stdc++.h>

using namespace std;

#define lowbit(x) (x & (-x))

typedef long long ll;

const int N = 200010;

int n,m;
int tr[N];
int g[N],l[N];

void add(int x, int c)
{
	for(int i = x; i <= n; i += lowbit(i)) tr[i] += c;
}

int sum(int x)
{
	int res = 0;
	for(int i = x; i; i -= lowbit(i)) res += tr[i];
	return res;
}

int main()
{
	cin>>n>>m;
	
	int a = 0, b;
	int w;
	for(int i = 1; i <= n; i ++ )
	{
		cin>>b;
		add(i, b - a);
		a = b;
	}
	
	for(int i = 1; i <= m; i ++ )
	{
		int f,x,y,k;
		cin>>f;
		if(f == 1)
		{
			cin>>x>>y>>k;
			add(x, k);
			add(y + 1, -k);
		}
		else if(f == 2)
		{
			cin>>x;
			cout<<sum(x)<<endl;
		}
	}
	return 0;
}

